package com.resolution.dietaryassessment.view.pagoda.fragment;

import android.os.Build;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.LinearLayout;

import androidx.annotation.DrawableRes;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.LinearLayoutManager;

import com.resolution.dietaryassessment.R;

/**
 * @author By Resolusion
 * @Title:
 * @Date: 2020/1/13
 * @Time: 10:18
 * @email Res01ution@foxmail.com
 */
public class TabFragment extends Fragment {

    private LinearLayout linearLayout;
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
    }

    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.fragment_view, container, false);
        linearLayout = view.findViewById(R.id.pagoda_bg);
        return view;
    }

    @Override
    public void onActivityCreated(@Nullable Bundle savedInstanceState) {
        super.onActivityCreated(savedInstanceState);
        Bundle bundle = getArguments();
        if (bundle != null) {
            linearLayout.setBackground(getResources().getDrawable(bundle.getInt("img")));
        }
    }

    public static TabFragment getInstance(@DrawableRes int id){
        TabFragment tabFragment = new TabFragment();
        Bundle bundle = new Bundle();
        bundle.putInt("img",id);
        tabFragment.setArguments(bundle);
        return tabFragment;
    }
}
